package com.qf.portal.web;

import com.qf.common.util.PropKit;
import com.qf.portal.pojo.po.Banner;
import com.qf.portal.pojo.po.Drugcat;
import com.qf.portal.service.PortalBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * Created by Administrator on 2018/6/3.
 */
@Controller
public class PortalAction {

    @Autowired
    private PortalBannerService portalBannerService;

    @RequestMapping(value = "portal/{page}")
    public String index(@PathVariable String page,HttpServletRequest request){
        Integer cid = PropKit.use("index.properties").getInt("lunbo.cid");
        List<Banner> bannerlist = portalBannerService.listBannerByCid(cid);
        List<Drugcat> drugcatList = portalBannerService.listDrugcat();
        request.setAttribute("bannerlist",bannerlist);
        request.setAttribute("drugcatList",drugcatList);
        return "portal/"+page;
    }
}
